import React from 'react';
import { Pagination } from 'antd';
import Pts from 'prop-types'

const Mypagination = (props) => {
    // console.log('current', props.current);

    // 切换分页的事件处理函数
    const changePageFn = (page, pageSize) => {
        console.log(page, pageSize);
        // 获取到了当前页数和每页条数
        // 当切换页面的时候, 进行当前页数据请求, 调用父组件中的方法
        props.setCurrentPage(page)
    }

    return (
        <div>
            <Pagination
                defaultCurrent={1}
                total={props.total}
                onChange={changePageFn}
            />
        </div>
    );
}
Mypagination.propTypes = {
    // current: Pts.number.isRequired,
    total: Pts.number.isRequired,
    setCurrentPage: Pts.func.isRequired

}
export default Mypagination;
